import React from 'react';
import {Form, message, Modal} from 'antd';
import ProForm, { ProFormTextArea } from '@ant-design/pro-form';
import {replyGoodsComments} from "@/services/ant-design-pro/goods";

const Index = (props) => {
  const {isModalVisible, handleCancel, id,mack} = props;
  const [form] = Form.useForm()

  return (
    <div>
      <Modal
        title="回复内容"
        visible={isModalVisible}
        onCancel={() => {
          handleCancel(false)
        }}
        width={800}
        onOk={()=>{
          form.validateFields().then( async merchant_reply_content =>{
            console.log(merchant_reply_content)
            await replyGoodsComments(id,{...merchant_reply_content})
            mack()
            handleCancel(false)
            message.success('回复成功')

          })

        }}
      >
          <ProForm
            submitter={false}
            form={form}
          >
            <ProFormTextArea
              name="merchant_reply_content"
              placeholder="请输入回复内容"
            />
          </ProForm>

      </Modal>
    </div>
  );
};

export default Index;
